﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Xml.Serialization;

namespace OnlineEducation.Models.ServerAPIModels
{
    public class CheckMeetingIsRunning
    {
        public string meetingID { get; set; }
    }

    public class CheckMeetingIsRunningResponse
    {
        public CheckMeetingIsRunngingResponseEntity response { get; set; }
    }
    [XmlRoot(ElementName ="response")]
    public class CheckMeetingIsRunngingResponseEntity
    {

        public string returncode { get; set; }
        public string running { get; set; }
       
    }

    public class SearchMeetingInfo
    {
        public string meetingID { get; set; }
    }

    public class SearchMeetingInfoesponse
    {
        public SearchMeetingInfoResponseEntity response { get; set; }
    }

    public class MeetingRecordsInfo
    {
        public string meetingID { get; set; }
        public string recordID { get; set; }
        public string state { get; set; }
        public string meta { get; set; }
    }
    [XmlRoot(ElementName ="response")]
    public class SearchMeetingInfoResponseEntity: MeetingInfo
    {
        public string returncode { get; set; }
        [XmlElement(ElementName = "metadata")]
        public Metadata metadata { get; set; }
        public string isBreakout { get; set; }

  
        public class Metadata
        {
            public string endcallbackurl { get; set; }
        } 
    }

    public class Attendee
    {
        public string userID { get; set; }
        public string fullName { get; set; }
        public string role { get; set; }
        public bool isPresenter { get; set; }
        public bool isListeningOnly { get; set; }
        public bool hasJoinedVoice { get; set; }
        public bool hasVideo { get; set; }
        public string clientType { get; set; }
    }

    public class MeetingInfo
    {
       
        public string meetingName { get; set; }
        public string meetingID { get; set; }
        public string internalMeetingID { get; set; }
        public string createTime { get; set; }
        public string createDate { get; set; }
        public string voiceBridge { get; set; }
        public string dialNumber { get; set; }
        /// <summary>
        /// 与会者的密码，
        /// </summary>
        public string attendeePW { get; set; }
        /// <summary>
        /// 主持人的密码
        /// </summary>
        public string moderatorPW { get; set; }
        public string running { get; set; }
        /// <summary>
        /// 会议的时长
        /// </summary>
        public string duration { get; set; }
        public string hasUserJoined { get; set; }
        /// <summary>
        /// 是否录屏
        /// </summary>
        public string recording { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string hasBeenForciblyEnded { get; set; }
        public string startTime { get; set; }
        public string endTime { get; set; }
        /// <summary>
        /// 会议参与者的人数
        /// </summary>
        public int participantCount { get; set; }
        /// <summary>
        /// 只能听的人数
        /// </summary>
        public int listenerCount { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int voiceParticipantCount { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public int videoCount { get; set; }
        /// <summary>
        /// 
        /// </summary>
        public string maxUsers { get; set; }
        public string moderatorCount { get; set; }

        [XmlArray("attendees")]
        [XmlArrayItem("attendee")]
        public List<Attendee> attendees { get; set; }
    }

    [XmlRoot(ElementName = "response")]
    public class GetMeetingsResponseEntity
    {
        public string returncode { get; set; }
        [XmlArray("meetings")]
        [XmlArrayItem("meeting")]
        public List<MeetingInfo> meetings { get; set; }
    }

    public class GetRecordingsRequest
    {
        public string meetingID { get; set; }
        /// <summary>
        /// 多个 recordID通过逗号分割，如果不指定recordId，就按照meetingID检索
        /// </summary>
        public string recordID { get; set; }
        /// <summary>
        ///  [processing|processed|published|unpublished|deleted]
        /// </summary>
        public string state { get; set; }
        /// <summary>
        /// 不能只使用meta作为参数，具体使用参考create
        /// </summary>
        public string meta { get; set; }
       
    }

    public class GetRecordingsResponse
    {
        public string returncode { get; set; }

    }

    public class Recording
    {
        public string recordID { get; set; }
        public string meetingID { get; set; }
        public string internalMeetingID { get; set; }
        public string name { get; set; }
        public bool isBreakout { get; set; }
        public bool published { get; set; }
        public string state { get; set; }
    }

    public class MeetingRecordsResponse
    {
        public string returncode { get; set; }
        public List<RecordingInfo> recordings { get; set; }
    }
   
    public class RecordingInfo
    {
        public string recordID { get; set; }
        public string meetingID { get; set; }
        public string internalMeetingID { get; set; }
        public string name { get; set; }
        public string isBreakout { get; set; }
        public string published { get; set; }
        public string state { get; set; }
        public string startTime { get; set; }
        public string endTime { get; set; }
        public int participants { get; set; }
        public Metadata metadata { get; set; } // 依赖在create那里数据传入的meta 数据
        public Playback playback { get; set; }
    }

    public class Playback
    {
        public List<FormatRecord> format { get; set; }

    }

    public class FormatRecord
    {
        public string Type { get; set; }
        public string url { get; set; }
        public int processingTime { get; set; }
        public int length { get; set; }

        public Preview preview { get; set; }
    }
    public class Preview
    {
        public List<ImageInfo> images { get; set; }
    }

    public class ImageInfo
    {
        public string image { get; set; }
    }


    public class Metadata
    {
        public bool isBreakout { get; set; }
        public string meetingName { get; set; }
        public bool gl_listed { get; set; }
        public string meetingId { get; set; }
    }


    #region publish record
    public class PublishRecording
    {
        public string recordID { get; set; }
        public string publish { get; set; }
    }

    public class PublishRecordingResponse
    {
        public string returncode { get; set; }
        public bool published { get; set; }
    }
    #endregion

    #region 删除录屏文件
    public class DeleteRecording
    {
        public string recordID { get; set; }
    }

    public class DeleteRecordingResponse
    {
        public string returncode { get; set; }
        public bool deleted { get; set; }
    }
    #endregion

    #region 更新录屏文件的meta_
    public class UpdateRecording
    {
        public string recordID { get; set; }
        /// <summary>
        /// 和create 生成的meta 参数相似，多个meta_** 用英文逗号隔开
        /// </summary>
        public string meta { get; set; }
    }

    public class UpdateRecordingResponse
    {
        public string returncode { get; set; }
        public bool updated { get; set; }
    }

    #endregion
    
}
